package com.sleepcamel.resteasyConfigurator.repository;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.ArrayList;

import com.sleepcamel.rest.domain.repository.IMimeTypeRepository;

abstract public class BaseMimeTypeRepository implements IMimeTypeRepository{

	protected ArrayList<String> types;

	public BaseMimeTypeRepository(InputStream is) {
		BufferedReader br = new BufferedReader(new InputStreamReader(is));
		String line = null;
		types = new ArrayList<String>();
		try {
			while ((line = br.readLine()) != null) {
				types.add(line);
			}
		} catch (IOException ex) {
			types.add("text/plain");
			types.add("application/xml");
			types.add("application/json");
			types.add("application/x-www-form-urlencoded");
		}
		try {
			br.close();
		} catch (IOException ex) {
			// do nothing!
			assert true;
		}
	}

}
